#ifndef __M_LOG_H__
#define __M_LOG_H__
using namespace std;

#define DBG_LEVEL 0
#define INF_LEVEL 1
#define ERR_LEVEL 2
#define DEFAULT_LEVEL DBG_LEVEL

#define LOG(level_str,level,format, ...){\
        if(level >= DEFAULT_LEVEL){\
            time_t t = time(nullptr);\
            struct tm* tm =  localtime(&t);\
            char s[1024];\
            size_t size = strftime(s,1023,"%H:%M:%S",tm);\
            printf("[%s][%s][%s:%d]\t" format "\n",level_str,s,__FILE__,__LINE__,##__VA_ARGS__);\
    }\
}\

#define DLOG(format, ...) LOG("DEBUG",DBG_LEVEL,format, ##__VA_ARGS__)
#define ILOG(format, ...) LOG("INFO",INF_LEVEL,format, ##__VA_ARGS__ )
#define ELOG(format, ...) LOG("ERROR",ERR_LEVEL,format, ##__VA_ARGS__ )

#endif